package com.sokal.easycare.modules.contract.entity;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.google.common.collect.Lists;
import com.sokal.easycare.common.persistence.DataEntity;
import com.sokal.easycare.modules.order.entity.UserOrder;

/**
 * 合同信息Entity
 * 
 * @author liliangdong
 * @version 2017-04-10
 */
public class ContractInfo extends DataEntity<ContractInfo> {

	private static final long serialVersionUID = 1L;
	private UserOrder userOrder; // 所属订单
	private String type; // 合同类型
	private String projectLocation; // 项目地点
	private Double totalAmout; // 合同总金额
	private Double payedAmout; // 已付总金额
	private String paymentMethod; // 付款方式
	private Date finishDate; // 竣工日期
	private Date signingDate; // 签订日期
	private Double printCount; // 打印次数
	private Date printDate; // 最后打印日期
	private Date downloadDate; // 最后下载日期
	private String state; // 状态
	private String signatureFlag; // 参与人盖章标志
	private List<ContractPaymentProportion> contractPaymentProportionList = Lists.newArrayList(); // 子表列表
	private List<ContractSchedule> contractScheduleList = Lists.newArrayList(); // 子表列表

	// 用于存储合同类型显示信息
	private Map<String, Object> typeMap = new HashMap<String, Object>();

	private String content;

	public ContractInfo() {
		super();
	}

	public ContractInfo(String id) {
		super(id);
	}

	public ContractInfo(UserOrder userOrder) {
		this.userOrder = userOrder;
	}

	public ContractInfo(String id, UserOrder userOrder) {
		super(id);
		this.userOrder = userOrder;
	}

	@NotNull(message = "所属订单不能为空")
	public UserOrder getUserOrder() {
		return userOrder;
	}

	public void setUserOrder(UserOrder userOrder) {
		this.userOrder = userOrder;
	}

	@Length(min = 1, max = 1, message = "合同类型长度必须介于 1 和 1 之间")
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@Length(min = 0, max = 255, message = "项目地点长度必须介于 0 和 255 之间")
	public String getProjectLocation() {
		return projectLocation;
	}

	public void setProjectLocation(String projectLocation) {
		this.projectLocation = projectLocation;
	}

	@NotNull(message = "合同总金额不能为空")
	public Double getTotalAmout() {
		return totalAmout;
	}

	public void setTotalAmout(Double totalAmout) {
		this.totalAmout = totalAmout;
	}

	public Double getPayedAmout() {
		return payedAmout;
	}

	public void setPayedAmout(Double payedAmout) {
		this.payedAmout = payedAmout;
	}

	@Length(min = 0, max = 1, message = "付款方式长度必须介于 0 和 1 之间")
	public String getPaymentMethod() {
		return paymentMethod;
	}

	public void setPaymentMethod(String paymentMethod) {
		this.paymentMethod = paymentMethod;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getFinishDate() {
		return finishDate;
	}

	public void setFinishDate(Date finishDate) {
		this.finishDate = finishDate;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getSigningDate() {
		return signingDate;
	}

	public void setSigningDate(Date signingDate) {
		this.signingDate = signingDate;
	}

	public Double getPrintCount() {
		return printCount;
	}

	public void setPrintCount(Double printCount) {
		this.printCount = printCount;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getPrintDate() {
		return printDate;
	}

	public void setPrintDate(Date printDate) {
		this.printDate = printDate;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getDownloadDate() {
		return downloadDate;
	}

	public void setDownloadDate(Date downloadDate) {
		this.downloadDate = downloadDate;
	}

	@Length(min = 0, max = 3, message = "状态长度必须介于 0 和 3 之间")
	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	@Length(min = 0, max = 3, message = "参与人盖章标志长度必须介于 0 和 3 之间")
	public String getSignatureFlag() {
		return signatureFlag;
	}

	public void setSignatureFlag(String signatureFlag) {
		this.signatureFlag = signatureFlag;
	}

	public List<ContractPaymentProportion> getContractPaymentProportionList() {
		return contractPaymentProportionList;
	}

	public void setContractPaymentProportionList(List<ContractPaymentProportion> contractPaymentProportionList) {
		this.contractPaymentProportionList = contractPaymentProportionList;
	}

	public List<ContractSchedule> getContractScheduleList() {
		return contractScheduleList;
	}

	public void setContractScheduleList(List<ContractSchedule> contractScheduleList) {
		this.contractScheduleList = contractScheduleList;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Map<String, Object> getTypeMap() {
		return typeMap;
	}

	public void setTypeMap(Map<String, Object> typeMap) {
		this.typeMap = typeMap;
	}

}